package threecard.android.room;

import threecard.android.MainActivity;
import threecard.android.room.Room;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;
import android.widget.ScrollView;

public class ViewRoom extends MainActivity implements OnClickListener{
	private int numberOfRooms;
	Room roomList[];
	private ScrollView roomView;

	private void getInfo() {
		numberOfRooms = 4;
		roomList = new Room[numberOfRooms];
		for (int i = 0; i < numberOfRooms; i++) {
			
			roomList[i] = new Room(this, "Room number " + i, i + 5);
		}
	}

	public void refreshView() {
		getInfo();
		
		roomView = new ScrollView(this);
		LinearLayout ll = new LinearLayout(this);
		
		ll.setOrientation(1);

		for (int i = 0; i < numberOfRooms; i++) {
			ll.addView(roomList[i]);
		}
		roomView.addView(ll, 0);
	}

	

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		refreshView();
		setContentView(roomView);
	}

	@Override
	public void onClick(View v) {
		Log.v("onClck", "View id: " + v.getId() + "\n Class: " + v.getClass());
		
	}

}
